package common;

import java.rmi.RemoteException;
import java.util.Calendar;

import common.rmi.event.RemoteBidEvent;

public class BidEvent extends Event implements RemoteBidEvent {
	
	private static final long serialVersionUID = 1L;
	
	private String userName;
	private long auctionID;
	private double price;
	
	public BidEvent(String type, String userName, long auctionID, double price) throws RemoteException {
		super(type);
		this.userName=userName;
		this.auctionID=auctionID;
		this.price=price;
	}
	
	public double getPrice(){
		return this.price;
	}

	@Override
	public String stringRep() throws RemoteException {
		Calendar time=Calendar.getInstance();
		time.setTimeInMillis(this.timestamp);
		return this.type+": "+time.getTime().toString()+" - username: "+userName+" AuctionID: "+auctionID+" Price: "+price;
	}

}
